home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2568 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: nyx10.cs.du.edu!not-for-mail
  2. From: ghuntres@nyx10.cs.du.edu (Gary  huntress)
  3. Newsgroups: comp.lang.c
  4. Subject: Unix Serial Port Programming
  5. Date: 22 Jan 1996 07:24:45 -0700
  6. Organization: Nyx, Public Access Unix (sponsored by U. of Denver Math/CS dept.)
  7. Message-ID: <4e06nd$kdl@nyx10.cs.du.edu>
  8. NNTP-Posting-Host: nyx10.nyx.net
  9. X-Disclaimer: Nyx is a public access Unix system run by the University of
  10.     Denver for the Denver community.  The University has neither
  11.     control over nor responsibility for the opinions of users.
  12.  
  13.  
  14. I posted this in comp.os.linux.misc a few days ago and I'm surprised
  15. that I've gotten no responses.  I'm hoping that someone here is
  16. familiar with unix serial ports.
  17.  
  18. regards,
  19.  
  20. gh
  21. /*************************************************/
  22. Hi,
  23.  
  24. I'm about to start a new project in an unfamiliar programming area, serial
  25. ports.  I bought a "micro-lan" development kit from Dallas Semiconductor.
  26. It allows temperature probes, addressable switches and other stuff to be
  27. read/written using only a twisted pair.  Unfortunatly, all of their software
  28. is in windows .DLLs and some example application level stuff, so I have to
  29. start from scratch configuring the serial port (baud rate etc) and
  30. reading/writing single bits.  Their programming model is the traditional 8
  31. word "brick" located at the base address for each DOS comm port, then they
  32. twiddle the bits individually for their configuration (i.e. setting the
  33. baud rate to exactly 10473 bps to achieve their port timing requirements) by
  34. using outp().
  35.  
  36. So, my question is:  What is the generic programming "model" for a serial
  37. port under linux?  I know I can fopen("/dev/mouse","r") and read a char, but
  38. can I write to it too?  (I tried, but I have no way to know if it worked).
  39. How do I access the remaining 7 bytes in the "brick"  (i.e. base addr+7)
  40. I sort of assume that I have to open() or fopen() the device  (probably not
  41. stream, I imagine).  Also, regarding the device, what is the diff between
  42. /dev/cua* and /dev/ttyS* ?
  43.  
  44. I can see that this is getting too hard already, drat...
  45.  
  46.  
  47. Gary Huntress
  48. huntress@rs2.npt.nuwc.navy.mil
  49. ghuntres@nox.cs.du.edu
  50.